import java.util.Scanner;

class Person{
    int score;
    String Name;

    public Person(int score, String name) {
        this.score = score;
        Name = name;
    }
}

public class TextDemo {
    public static void main(String[] args) {

    }

    public static void main2(String[] args) {

            Scanner scanner = new Scanner(System.in);
            int num = scanner.nextInt();
            Person[] person = new Person[num];
            for (int i = 0; i < num; i++) {
                person[i] = new Person(scanner.nextInt(), scanner.nextLine());
            }
            int choice = scanner.nextInt();
            if (choice == 0) {
                //降序
            } else {
                //升序
            }
            //输出
        }

    public static int Max(int[] arr,int left,int right){
        if(left==right){
            return arr[right];
        }
        int mid = left+((right-left)>>2);
        int leftMax = Max(arr,left,mid);
        int rightMax =Max(arr,mid+1,right);

        return Math.max(leftMax,rightMax);

    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        int[] arr = new int[num];
        for(int i = 0;i<arr.length;i++){
            arr[i] = scanner.nextInt();
        }
        int left = 0;
        int right = arr.length-1;
        System.out.println(Max(arr,left,right));
    }
}
